/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Easy.table;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author DR.HUY
 */
@Entity
@Table(name = "Ticket", catalog = "EasyTicket", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Ticket.findAll", query = "SELECT t FROM Ticket t"),
    @NamedQuery(name = "Ticket.findByTicketID", query = "SELECT t FROM Ticket t WHERE t.ticketID = :ticketID"),
    @NamedQuery(name = "Ticket.findByTicketName", query = "SELECT t FROM Ticket t WHERE t.ticketName = :ticketName"),
    @NamedQuery(name = "Ticket.findByTotal", query = "SELECT t FROM Ticket t WHERE t.total = :total"),
    @NamedQuery(name = "Ticket.findByDateTime", query = "SELECT t FROM Ticket t WHERE t.dateTime = :dateTime"),
    @NamedQuery(name = "Ticket.findByQuantity", query = "SELECT t FROM Ticket t WHERE t.quantity = :quantity"),
    @NamedQuery(name = "Ticket.findByDecription", query = "SELECT t FROM Ticket t WHERE t.decription = :decription"),
    @NamedQuery(name = "Ticket.findByStatus", query = "SELECT t FROM Ticket t WHERE t.status = :status"),
    @NamedQuery(name = "Ticket.findByPrice", query = "SELECT t FROM Ticket t WHERE t.price = :price")})
public class Ticket implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "TicketID", nullable = false)
    private Integer ticketID;
    @Basic(optional = false)
    @Column(name = "TicketName", nullable = false, length = 50)
    private String ticketName;
    @Basic(optional = false)
    @Column(name = "Total", nullable = false, length = 50)
    private String total;
    @Column(name = "DateTime", length = 50)
    private String dateTime;
    @Column(name = "Quantity", length = 10)
    private String quantity;
    @Column(name = "Decription", length = 50)
    private String decription;
    @Column(name = "Status", length = 10)
    private String status;
    @Column(name = "Price", length = 50)
    private String price;
    @JoinColumn(name = "PlaceID", referencedColumnName = "PlaceID", nullable = false)
    @ManyToOne(optional = false)
    private Places places;
    @JoinColumn(name = "EventID", referencedColumnName = "EventID", nullable = false)
    @ManyToOne(optional = false)
    private Event event;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ticket")
    private Collection<TicketReport> ticketReportCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ticket")
    private Collection<OrderDetail> orderDetailCollection;

    public Ticket() {
    }

    public Ticket(Integer ticketID) {
        this.ticketID = ticketID;
    }

    public Ticket(Integer ticketID, String ticketName, String total) {
        this.ticketID = ticketID;
        this.ticketName = ticketName;
        this.total = total;
    }

    public Integer getTicketID() {
        return ticketID;
    }

    public void setTicketID(Integer ticketID) {
        this.ticketID = ticketID;
    }

    public String getTicketName() {
        return ticketName;
    }

    public void setTicketName(String ticketName) {
        this.ticketName = ticketName;
    }

    public String getTotal() {
        return total;
    }

    public void setTotal(String total) {
        this.total = total;
    }

    public String getDateTime() {
        return dateTime;
    }

    public void setDateTime(String dateTime) {
        this.dateTime = dateTime;
    }

    public String getQuantity() {
        return quantity;
    }

    public void setQuantity(String quantity) {
        this.quantity = quantity;
    }

    public String getDecription() {
        return decription;
    }

    public void setDecription(String decription) {
        this.decription = decription;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public Places getPlaces() {
        return places;
    }

    public void setPlaces(Places places) {
        this.places = places;
    }

    public Event getEvent() {
        return event;
    }

    public void setEvent(Event event) {
        this.event = event;
    }

    public Collection<TicketReport> getTicketReportCollection() {
        return ticketReportCollection;
    }

    public void setTicketReportCollection(Collection<TicketReport> ticketReportCollection) {
        this.ticketReportCollection = ticketReportCollection;
    }

    public Collection<OrderDetail> getOrderDetailCollection() {
        return orderDetailCollection;
    }

    public void setOrderDetailCollection(Collection<OrderDetail> orderDetailCollection) {
        this.orderDetailCollection = orderDetailCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ticketID != null ? ticketID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ticket)) {
            return false;
        }
        Ticket other = (Ticket) object;
        if ((this.ticketID == null && other.ticketID != null) || (this.ticketID != null && !this.ticketID.equals(other.ticketID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Easy.table.Ticket[ticketID=" + ticketID + "]";
    }

}
